import logging

from redis import StrictRedis


class Config(object):
    DEBUG = True
    SECRET_KEY = 'SDADASD'
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    # 数据库配置
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:mysql@127.0.0.1:3306/news"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # redis配置
    Redis_Host = "127.0.0.1"
    Redis_Port = 6379
    # session配置
    SESSION_TYPE = 'redis'
    SESSION_USE_SIGNER = True
    SESSION_REDIS = StrictRedis(Redis_Host, Redis_Port)
    SESSION_PERMANENT = False
    PERMANENT_SESSION_LIFETIME = 3600 * 24 * 2
    LEVEL = logging.DEBUG


class Develop(Config):
    pass


class Product(Config):
    DEBUG = False
    LEVEL = logging.ERROR


class Debug(Config):
    DEBUG = False


config_dict = {
    "develop": Develop,
    "debug": Debug,
    "product": Product
}
